package com.test.service;

import com.test.dao.AccountDao;
import com.test.domain.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class AccountService {

    private final AccountDao accountDao;

    @Autowired
    public AccountService(AccountDao accountDao) {
        this.accountDao = accountDao;
    }

    public List<Account> getAccountList(String customerPhoneNumber){
        return accountDao.getAccountListByCustomerPhoneNumber(customerPhoneNumber);
    }

    public int insertAccount(Account account){
        return accountDao.insertAccount(account);
    }

    public void deleteAccount(String accountNumber,String customerPhoneNumber){
        accountDao.deleteAccountByAccountNumberAndCustomerPhoneNumber(accountNumber,customerPhoneNumber);
    }

}
